package com.xj.demo.unknow;

/**
 * vm args: -Xmx256m -Xms256m -XX:+DoEscapeAnalysis -XX:+PrintGCDetails
 */
public class StackAllocationTest {
    public static void main(String[] args) {
        long l = System.currentTimeMillis();
        for (int i = 0; i < 10000000; i++) {
            allocate();
        }
        System.out.println("耗时" + (System.currentTimeMillis() - l) + "ms");
        try {
            Thread.sleep(1000000);
        } catch (InterruptedException e) {
            throw new RuntimeException(e);
        }
    }
    public static User allocate(){
        return new User();
    }
    static class User{}
}
